<template>
	<BaseContainer>
		<aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig" :formConfig="formConfig" :operateFormate="operateFormate">
			<template v-slot:beAreaNames="{ row }">
				{{ row.beAreaName || row.beCityName || row.beProvinceName }}
			</template>
		</aplid-base-crud>
	</BaseContainer>
</template>

<script setup>
import { baseConfig, formConfig as baseFormConfig } from './config'
import { ElMessage, ElMessageBox } from 'element-plus'

const formConfig = ref(baseFormConfig())
const operateFormate = async (row, type) => {
	return new Promise((resolve, reject) => {
		if (type == 'claim') {
			formConfig.value = baseFormConfig(2)
			row.handleStatus = 2
			row.handleStatusLabel = '处理中'
			row.adviserName = ''
			row.adviserIdCard = ''
		} else {
			formConfig.value = baseFormConfig(row.handleStatusLabel)
		}
		if (type == 'calcel_claim' || !row.handleStatusLabel) {
			row.handleStatus = 1
			row.handleStatusLabel = '待处理'
			row.adviserName = ''
			row.adviserIdCard = ''
		}
		resolve({
			...row,
		})
	})
}
</script>

<style lang="scss" scoped></style>
